import request from '@/utils/request';

//发送验证码
export function sendCode(userMail) {
    return request({
        url: `/user/code`,
        method: "get",
        params: {userMail}
    })
}

//注册
export function register(user) {
    return request({
        url: `/register`,
        method: "post",
        data: user
    })
}

//登录
export function login(user) {
    return request({
        url: `/login`,
        method: "post",
        data: user
    })
}
//QQ登录
export function QQLogin(user) {
    return request({
        url: `/user/oauth/qq`,
        method: "post",
        data: user
    })
}
//微博登录
export function WeiBoLogin(user) {
    return request({
        url: `/user/oauth/weibo`,
        method: "post",
        data: user
    })
}
//退出
export function logout() {
    return request({
        url: `/logout`,
        method: "get",
    })
}
//更改用户信息
export function changeUserInfo(userInfo) {
    return request({
        url: `/user/info`,
        method: "put",
        data: userInfo
    })
}
//更改邮箱
export function changeEmail(email) {
    return request({
        url: `/user/email`,
        method: "put",
        data: email
    })
}
//更改密码
export function changePassword(user) {
    return request({
        url: `/user/password`,
        method: "post",
        data: user
    })
}
//查询评论
export function commentList(comment) {
    return request({
        url: `/comments`,
        method: "get",
        params: comment
    })
}
//查询回复评论
export function replyCommentById(commentId,condition) {
    return request({
        url: `/comments/${commentId}/reply`,
        method: "get",
        params: condition
    })
}
//添加评论
export function addComment(comment) {
    return request({
        url: `/comments`,
        method: "post",
        data: comment
    })
}
//点赞文章
export function articleLike(articleId) {
    return request({
        url: `/article/${articleId}/like`,
        method: "post",
    })
}
//点赞说说
export function talkLike(talkId) {
    return request({
        url: `/talk/${talkId}/like`,
        method: "post",
    })
}
//点赞评论
export function commentLike(commentId) {
    return request({
        url: `/comment/${commentId}/like`,
        method: "post",
    })
}
//关于我
export function about() {
    return request({
        url: `/about`,
        method: "get",
    })
}




